package com.ebupt.migu.music.login.service;

import com.ebupt.migu.music.login.mapper.TokenLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 *
 * @program : workorder
 * @description : 登陆令牌记录，只保存24小时内的记录，用于进行数据对比
 * @author : zhanggk
 * @create : 2019-03-01 17:25
 **/
@Service
public class TokenLogService {
	@Autowired
	private TokenLogMapper tokenLogMapper;

	/**
	 * 添加登陆令牌
	 * @param paramMap 令牌
	 */
	public void addTokenLog(Map<String, Object> paramMap){
		tokenLogMapper.addTokenLog(paramMap);
	}

	/**
	 * 查询当前数据中,是否有当前令牌<br/>
	 * 查询前先删除超过24小时的令牌
	 * @param paramMap 令牌
	 * @return
	 */
	public int queryByToken(Map<String, Object> paramMap){
		tokenLogMapper.deleteTokenLog();
		return  tokenLogMapper.queryByToken(paramMap);
	}

}
